package com.vakitdaraliyor.www.servlet;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.vakitdaraliyor.www.dao.CountdownDao;
import com.vakitdaraliyor.www.entity.Countdown;

@WebServlet("/Sil")
public class SilServlet extends HttpServlet
{
	
	private static final long serialVersionUID = 1L;
	@EJB
    private CountdownDao countdownDao;

    public SilServlet()
    {
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        String ad = request.getParameter("gerisayimAdi");
        String tarih = request.getParameter("gerisayimTarihi");
        String saat = request.getParameter("gerisayimSaati");
        int id = Integer.parseInt(request.getParameter("gerisayimId"));
        Countdown gerisayim2 = new Countdown(id, ad, tarih,saat);
        countdownDao.sil(gerisayim2);
        response.sendRedirect(request.getContextPath() + "/Admin");
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        doGet(request, response);
    }

    
}